package com.xuxuduoduomei.knowledge_base.controller;

import com.xuxuduoduomei.knowledge_base.domain.Test;
import com.xuxuduoduomei.knowledge_base.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:xuxuduoduomei
 * @Date:2021/12/17 20:12
 */

@RestController
public class TestController {

    @Value("${test.hello:Test}")
    private String testHello;

    @Autowired
    private TestService testService;


    //    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    @GetMapping("/hello")
    public String hello() {
        return "hello world!!!!!" + testHello;
    }

    @PostMapping("/hello/post")
    public String helloPost(String name) {
        return "hello world!!!!!post，" + name;
    }

    @GetMapping("/test/list")
    public List<Test> list() {
        return testService.list();
    }



}
